//
//  SwitchViewController.swift
//  table
//
//  Created by admin on 14/9/11.
//  Copyright (c) 2014年 sinosun. All rights reserved.
//

import UIKit

class SwitchViewController: UIViewController {
    
    /*
    @availability(iOS, introduced=5.0)
    var onTintColor: UIColor!
    @availability(iOS, introduced=6.0)
    var tintColor: UIColor!
    @availability(iOS, introduced=6.0)
    var thumbTintColor: UIColor!
    
    @availability(iOS, introduced=6.0)
    var onImage: UIImage!
    @availability(iOS, introduced=6.0)
    var offImage: UIImage!
    
    var on: Bool
    
    init(frame: CGRect) // This class enforces a size appropriate for the control. The frame size is ignored.
    
    func setOn(on: Bool, animated: Bool) // does not send action
    
    */
    @IBOutlet weak var yes_or_no: UISwitch!
    
    @IBOutlet weak var silider: UISlider!
    
    @IBOutlet weak var segmented: UISegmentedControl!
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        self.yes_or_no.setOn(false, animated: true)
        
        /*
        var value: Float // default 0.0. this value will be pinned to min/max
        var minimumValue: Float // default 0.0. the current value may change if outside new min value
        var maximumValue: Float // default 1.0. the current value may change if outside new max value
        
        var minimumValueImage: UIImage! // default is nil. image that appears to left of control (e.g. speaker off)
        var maximumValueImage: UIImage! // default is nil. image that appears to right of control (e.g. speaker max)
        
        var continuous: Bool // if set, value change events are generated any time the value changes due to dragging. default = YES
        */
        //        self.silider.minimumValue = 0.0
        //        self.silider.maximumValue = 10.0
        //        self.silider.minimumValueImage = UIImage(named: "1410440401_icon-ios7-volume-high-48")
        //        self.silider.maximumValueImage = UIImage(named: "1410440504_icon-ios7-volume-low-64")
        
        /*
        @availability(iOS, introduced=5.0)
        var minimumTrackTintColor: UIColor!
        @availability(iOS, introduced=5.0)
        var maximumTrackTintColor: UIColor!
        @availability(iOS, introduced=5.0)
        var thumbTintColor: UIColor!
        */
        
        self.silider.minimumTrackTintColor = UIColor.blackColor()
        self.silider.maximumTrackTintColor = UIColor.redColor()
        self.silider.thumbTintColor = UIColor.blackColor()
        
        self.silider.setThumbImage(UIImage(named: "1410441191_speech-bubble-64"), forState: UIControlState.Highlighted)
        
        
        self.segmented.tintColor = UIColor.redColor()
        //        self.segmented.setBackgroundImage(UIImage(named: "1410441191_speech-bubble-64"), forState: UIControlState.Normal, barMetrics: UIBarMetrics.Default)
        
        
        
    }
    
    
    
    @IBAction func slider_value_change(sender: AnyObject) {
        var slider = sender as UISlider
        println(slider.value)
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    @IBAction func valueChange(sender: AnyObject) {
        println("\(yes_or_no.on)")
    }
    
    
    
    @IBAction func segemented_value_change(sender: AnyObject) {
        var segment = sender as UISegmentedControl
        println(segment.selectedSegmentIndex)
    }
    
    /*
    // MARK: - Navigation
    
    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.
    }
    */
    
}
